<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="web1.servlet.hello" %>
    <%@ page import="web1.bean.user" %>
    <%
    String path=request.getContextPath();
    String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<b>
path=request.getContextPath()<br>
:<%=path %><br>
basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"<br>
:<%=basePath %><br>
</b>
<p>如何正确的访问servlet路径</p>
<ul>
<li><a href="s/hello" target_blank">访问servlet(s/hello)</a></li>
<li><a href="/s/hello" target_blank">访问servlet(/s/hello)</a></li>
<li><a href="web1/s/hello" target_blank">访问servlet(web1/s/hello)</a></li>
<li><a href="/web1/s/hello" target_blank">访问servlet(/web1/s/hello)</a></li>
<li><a href="<%=basePath %>s/hello" target_blank">访问servlet(<%=basePath %>s/hello)</a></li>
<hr>
<li><a href="callservlet.jsp" target="_blank">跳转到servlet</a></li>
<p>import自定义的bean<br>
<%
user u=new user();
u.setName("xh");
out.println("u.getName='"+u.getName()+"'");
%>
</p>
<p>
<% 
hello h=new hello();
out.println("h.toString()='"+h.toString()+"'");
%>
</p>

</ul>
<p>注意：s/hello:返回的是当前文件夹下
/s/hello：在服务端下的

</p>
</body>
</html>